import {
  request
} from "../../api/request.js";

// 获取商品列表
export function getGoodsList(params,isCustomLoading) {
  return request(
    `/api/ProductGoods`,
    "get",
    params,
    isCustomLoading
  );
}

// 获取商品详情
export function getGoodsDetail(id) {
  return request(
    `/api/ProductGoods/${id}`,
    "get"
  );
}

// 获取商品评价列表
export function getEvaluateListByGoods(id,params) {
  return request(
    `/api/ProductGoods/${id}/Evaluate`,
    "get",
    params
  );
}

// 购物车列表
export function getGoodsCarNum(params) {
  return request(
    `/api/ProductGoodsShoppingCart`,
    "get",
    params
  );
}

// 添加购物车
export function addGoodsInCar(data,isCustomLoading) {
  return request(
    `/api/ProductGoodsShoppingCart/BatchSave`,
    "post",
    data,
    isCustomLoading
  );
}

// 下单页获取数据
export function getOrderPayInfo(data) {
  return request(
    `/api/ProductOrder/OrderAmount`,
    "post",
    data
  );
}

// 优惠券列表
export function getCouponPageList(data,isCustomLoading) {
  return request(
    `/api/Discount/All`,
    "post",
    data,
    isCustomLoading
  );
}

// 优惠券列表
export function payGoodsOrder(data) {
  return request(
    `/api/ProductOrder/Pay`,
    "put",
    data
  );
}

// 生成订单
export function initOrderInfo(data) {
  return request(
    `/api/ProductOrder/Batch`,
    "post",
    data
  );
}

